package ymbky.firstcodesunnyweather.planbook

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel

class MainViewModel:ViewModel() {
    var mrecordLiveData = MutableLiveData<ArrayList<Record>>()

    val record:LiveData<ArrayList<Record>> = Transformations.switchMap(mrecordLiveData){recordId->
        Repository.getRecord(recordId)}

    fun getRecord(recordId: ArrayList<Record>): LiveData<ArrayList<Record>> {

        return Repository.getRecord(recordId)
    }
}